import { IPSDataEntity } from '../ipsdata-entity';
import { IPSDEDataQueryInput } from './ipsdedata-query-input';
import { IPSDEFilterDTO } from './ipsdefilter-dto';
import { PSModelObjectImpl } from '../../psmodel-object-impl';

export class PSDEDataQueryInputImpl extends PSModelObjectImpl implements IPSDEDataQueryInput {
  get codeName(): string {
    return this.M.codeName;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  get memo(): string {
    return this.M.memo;
  }

  get name(): string {
    return this.M.name;
  }

  protected psdefilterdto: IPSDEFilterDTO | null = null;

  getPSDEFilterDTO(): IPSDEFilterDTO | null {
    if (this.psdefilterdto != null) return this.psdefilterdto;
    const value = this.M.getPSDEFilterDTO;
    if (value == null) {
      return null;
    }
    const ipsdataentity = this.getParentPSModelObject('dataentity.IPSDataEntity') as IPSDataEntity;
    if (ipsdataentity != null) {
      this.psdefilterdto = ipsdataentity.findPSDEMethodDTO(value) as IPSDEFilterDTO;
    }
    return this.psdefilterdto;
  }

  get psDEFilterDTO(): IPSDEFilterDTO | null {
    return this.getPSDEFilterDTO();
  }

  getPSDEFilterDTOMust(): IPSDEFilterDTO {
    const value = this.getPSDEFilterDTO();
    if (value == null) {
      throw new Error('未指定实体过滤器DTO');
    }
    return value;
  }

  get type(): 'NONE' | 'KEYFIELD' | 'KEYFIELDS' | 'DTO' | 'DTOS' | 'FILTER' | 'UNKNOWN' | 'USER' | 'USER2' {
    return this.M.type;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get cls(): string {
    return 'PSDEDataQueryInputImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'dataentity.ds.IPSDEDataQueryInput' || cls == 'dataentity.service.IPSDEMethodInput') return true;
    return super.instanceof(cls);
  }
}
